package logic

import (
	"context"
	"house/models"

	"house/house"
	"house/internal/svc"

	"github.com/zeromicro/go-zero/core/logx"
)

type UserListLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewUserListLogic(ctx context.Context, svcCtx *svc.ServiceContext) *UserListLogic {
	return &UserListLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

// 房源列表
func (l *UserListLogic) UserList(in *house.UserListReq) (*house.UserListResp, error) {
	// todo: 用户列表
	var u models.User
	list := u.FindUser(int(in.Status))
	var lists []*house.UserList
	for _, v := range list {
		lists = append(lists, &house.UserList{
			Nick:        v.Nick,
			RealName:    v.RealName,
			IdCard:      v.IdCard,
			IdCardFrond: v.IdCardFrond,
			IdCardSide:  v.IdCardSide,
			Status:      int64(v.Status),
		})
	}
	return &house.UserListResp{
		List: lists,
	}, nil
}
